To create a link from one
Org file to another, you would use something like
‘[[file:foo.org][The
foo]]’ or simply ‘file:foo.org.’ (see Hyperlinks). When published,
this link becomes a link to foo.html. In this way, you can interlink the
pages of your "org web" project and the links will work as
expected when you publish them to HTML. If you also publish the
Org source file and want to link to that, use an
http: link instead of a file: link,
because file: links are converted to link to the
corresponding html
file.
You may also link to related files, such as images. Provided you are careful with relative file names, and provided you have also configured Org to upload the related files, these links will work too. See Complex example, for an example of this usage.
Sometimes an Org file to be published may contain links that are only valid in your production environment, but not in the publishing location. In this case, use the property
:link-validation-function |
Function to validate
links |
to define a function for checking link
validity. This function must accept two arguments, the file name
and a directory relative to which the file name is interpreted in
the production environment. If this function returns
nil, then the HTML generator will only insert a
description into the HTML file, but no link. One option for this
function is org-publish-validate-link which checks
if the given file is part of any project in
org-publish-project-alist.